import java.util.Scanner;

public class Test {
    public static void sort1(int[] array) {
        int[] array2 = new int[array.length];
        int j = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 != 0) {
                array2[j] = array[i];
                j++;
            }
        }
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 == 0) {
                array2[j] = array[i];
                j++;
            }
        }
        for (int i = 0; i < array.length; i++) {
            array[i] = array2[i];
        }
    }
    public static void sort(int[] array) {
        int i = 0;
        int j = array.length - 1;
        while(i < j) {
            while(i < j && array[i] % 2 != 0) {
                i++;
            }
            while(i < j && array[j] % 2 == 0) {
                j--;
            }
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
        }

    }
    public static void main(String[] args) {
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < array.length; i++) {
            array[i] = sc.nextInt();
        }
        sort(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
    }
}

